import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ColorAction implements ActionListener {
    private Color backgroundColor;
    private JPanel buttonPanel;

    public ColorAction(Color c,JPanel p){
        backgroundColor = c;
        buttonPanel = p;
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        buttonPanel.setBackground(backgroundColor);
    }
}
